import 'package:cbec_app/entity/home/content/content_data.dart';

class RichTextData extends ContentData {
  final String? color;
  final int? fullscreen;
  final String? uuid;
  final String? content;

  RichTextData({
    this.color,
    this.fullscreen,
    this.uuid,
    this.content,
  }) {
    type = "rich_text"; // 设置类型
  }

  factory RichTextData.fromJson(Map<String, dynamic> json) {
    return RichTextData(
      color: json['color'],
      fullscreen: json['fullscreen'],
      uuid: json['uuid'],
      content: json['content'],
    );
  }

  @override
  Map<String, dynamic> toJson() {
    return {
      'color': color,
      'fullscreen': fullscreen,
      'uuid': uuid,
      'content': content,
      'type': type, // 包含 type 字段
    };
  }

  @override
  ContentData fromJson(Map<String, dynamic> json) {
    return RichTextData.fromJson(json);
  }
}
